<?php

$query = new ObjLib\Query (array (
	'tables' => $_REQUEST['className'],
	'perPage' => 50,
	'pageNum' => 1
));

if (!empty($_REQUEST['title_id'])) {
	$query->where = "level0.title like '%{$_REQUEST['title_id']}%' or level0.id like '{$_REQUEST['title_id']}%'";
}

$components = $query->select ();

?>
<?php foreach ($components as $component) { ?>
	<option value="<?php echo $component->id ?>"><?php echo $component->title ?></option>
<?php } ?>